from config.configs import DINGSTOCK_HOST, DINGSTOCK_PORT, GOAT_ERP_HOST, GOAT_ERP_PORT, DESKTOP_PATH, DATA_PATH
import pymongo
from tools.funciton import read_xlsx_file
import os
import jionlp as jio
import requests
import random
import time
import string

ding = pymongo.MongoClient(host=DINGSTOCK_HOST, port=DINGSTOCK_PORT, authMechanism='DEFAULT', authSource='admin',
                           directConnection=True)
express = ding.express


def create_order(id, userid, orderNo, PlatCode, pickupCode, paymentNumber):
    """造待揽件数据，返回请求报文"""
    param1 = {
        "_id": id,
        "userId": userid,
        "channelId": "mLkWguU0Ta",
        "orderNo": orderNo,
        "status": "已签收",
        "senderName": "兔兔兔头",
        "senderMobile": "13948764329",
        "senderProvince": "四川省",
        "senderCity": "成都市",
        "senderArea": "双流区",
        "senderDetailAddress": "天府五街软件园",
        "receiverName": "Dc",
        "receiverMobile": "13649009863",
        "receiverProvince": "江西省",
        "receiverCity": "南昌市",
        "receiverArea": "红谷滩区",
        "receiverDetailAddress": "用友产业园",
        "discount": 0.63,
        "dcDiscount": 0.68,
        "preWeight": 1,
        "originalPreAmount": 14,
        "preAmount": 8.82,
        "dcPreAmount": 0.01,
        "decPreAmount": 0,
        "addPreAmount": 0,
        "dcPreSumAmount": 0.01,
        "decPrice": 0,
        "decAmount": 0,
        "addAmount": 0,
        "freightRepairAmount": 7.62,
        "freightRepairedAmount": 0,
        "payAmount": 0.01,
        "startAt": 1719723600000,
        "endAt": 1719727200000,
        "goodsName": "鞋服",
        "goodsNum": 1,
        "isSettle": 1,
        "paymentNumber": paymentNumber,
        "trace": [],
        "isPush": False,
        "createdAt": int(round(time.time() * 1000)),
        "updatedAt": int(round(time.time() * 1000)),
        "__v": 0,
        "pickupCode": pickupCode,
        "platformData": {
            "EBusinessID": 25346,
            "Success": True,
            "ResultCode": 100,
            "Reason": "查询成功",
            "UniquerRequestNumber": "984fd08c-2034-1a72-c655-2b2ce991e7b8",
            "PlatCode": PlatCode,
            "OrderCode": orderNo,
            "LogisticCode": pickupCode,
            "Quantity": 1,
            "Weight": 1,
            "Volume": 9800,
            "PayType": 2,
            "State": 3,
            "TotalFee": 7.0600000000000005,
            "CreateTime": int(round(time.time())),
            "ExpType": "PACKAGE",
            "ShipperCode": "DB",
            "OfficialFee": 11.2,
            "Cost": 7.06,
            "chargedWeight": 1.63,
            "InsureAmount": 0,
            "InsureValue": 0,
            "BackLogisticCode": "",
            "BackFee": 0,
            "PackageFee": 0,
            "OtherFee": 0,
            "PersonName": "肖刚",
            "PersonTel": "16626332829",
            "PersonCode": None,
            "StationName": None,
            "StationCode": None,
            "StationAddress": None,
            "StationTel": None,
            "PickupCode": None
        },
        "chargeWeight": 1.63,
        "dcRealAmount": 7.63,
        "dcSumAmount": 7.63,
        "originalAmount": 11.21,
        "realAmount": 7.06,
        "realWeight": 1,
        "sumAmount": 7.06
    }
